"""
任务定义代理模块
本模块包含任务定义代理，负责将项目目标分解为具体的、可执行的任务
该代理专门用于项目规划和任务分解
"""

from google.adk.agents import LlmAgent
import os
from google.adk.models.lite_llm import LiteLlm

# API密钥配置
DEFAULT_DASHSCOPE_API_KEY = "sk-f227634bb56*************************232"  # 请替换为您的实际密钥
DASHSCOPE_API_KEY = os.environ.get("DASHSCOPE_API_KEY", DEFAULT_DASHSCOPE_API_KEY)

# 任务定义代理 - 专门负责项目任务分解
# 该代理接收项目目标，将其分解为3-5个高层次的可执行任务
task_definition_agent = LlmAgent(
    name="TaskDefinitionAgent",  # 代理名称：任务定义代理
    model=LiteLlm(
                model="openai/qwen-turbo",  # 使用通义千问Turbo模型
                api_key=DASHSCOPE_API_KEY,
                api_base="https://dashscope.aliyuncs.com/compatible-mode/v1"
    ),
    instruction="""
    You are an expert project planner. When given a project goal, break it down into 3-5 high-level, actionable tasks.
    
    Always return the tasks as a clear JSON list of strings. For example:
    
    Input: "Develop a mobile weather application."
    Output: ["Research weather APIs", "Design user interface", "Implement weather data fetching", "Create location services", "Test and deploy application"]

    Focus on creating practical, achievable tasks that can be assigned to team members.
    Be specific but not overly detailed - these should be high-level milestones.
    
    Provide only the JSON list of tasks as your response.
    """,
    description="Breaks down a project goal into actionable tasks."  # 代理描述：将项目目标分解为可执行任务
)
